Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple uploaded files examples #117

Merged
merged 2 commits into from
May 25, 2023

Conversation

t0yohei
Copy link

@t0yohei t0yohei commented May 21, 2023

Adjust the multiple example parameters.

I get this linting error with an endpoint that receives an uploaded file: unknown tag !<!ruby/object:File>

The spec is structured in this way:

  describe "POST /api/v1/my_pages" do
    subject do
      post api_v1_my_pages_path(my_page), params: params, headers: default_headers
    end

    let!(:user) { create(:user) }
    let!(:my_page) { create(:my_page) }
    let(:params) { { example: { title: 'test', images: [fixture_file_upload('/images/Logo.png')] } } }

      it 'success' do
        sign_in user
        expect(response).to have_http_status(:created)
      end

I have added the fix for this issue by speculating that the cause lies in the schema_builder.rb file's failure to handle cases where image is sent as an array.

@t0yohei t0yohei force-pushed the fix-multiple-uploaded-file-examples branch from 7dfe7fc to c876cac Compare May 21, 2023 15:47
@codecov
Copy link

codecov bot commented May 21, 2023

Codecov Report

Merging #117 (7e30bac) into master (27cc49e) will increase coverage by 1.33%.
The diff coverage is 91.11%.

@@            Coverage Diff             @@
##           master     #117      +/-   ##
==========================================
+ Coverage   64.50%   65.83%   +1.33%     
==========================================
  Files          31       31              
  Lines         648      685      +37     
==========================================
+ Hits          418      451      +33     
- Misses        230      234       +4     
Impacted Files Coverage Δ
lib/rspec/openapi/schema_builder.rb 19.35% <0.00%> (-0.87%) ⬇️
spec/rails/app/controllers/images_controller.rb 100.00% <100.00%> (ø)
spec/rails/config/routes.rb 100.00% <100.00%> (ø)
spec/requests/rails_spec.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@t0yohei t0yohei force-pushed the fix-multiple-uploaded-file-examples branch from c876cac to ad2913a Compare May 21, 2023 15:53
@t0yohei t0yohei force-pushed the fix-multiple-uploaded-file-examples branch from daca0a8 to 7e30bac Compare May 21, 2023 17:24
Copy link
Owner

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks

@exoego exoego added the bug Something isn't working label May 25, 2023
@exoego exoego merged commit 1792aee into exoego:master May 25, 2023
@t0yohei t0yohei deleted the fix-multiple-uploaded-file-examples branch May 25, 2023 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants